<!DOCTYPE html>
<html>
<head>
    <title>sync.Pool 工作流程图</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            background-color: #f9f9f9;
        }
        .flowchart {
            display: grid;
            grid-template-columns: repeat(3, auto);
            gap: 20px;
            align-items: center;
            justify-items: center;
        }
        .node, .decision {
            padding: 10px 15px;
            border: 2px solid #333;
            border-radius: 5px;
            text-align: center;
            background-color: #fff;
            box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
        }
        .decision {
            background-color: #e0f7fa;
            transform: rotate(45deg);
            line-height: 1.4;
            width: 120px;
            height: 120px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .decision > span {
            transform: rotate(-45deg);
        }
        .arrow {
            width: 40px;
            height: 40px;
        }
        .arrow img {
            width: 100%;
        }
        .conditional {
            display: flex;
            justify-content: space-between;
            width: 120px;
        }
        .conditional span {
            font-weight: bold;
        }
        .yes {
            color: green;
        }
        .no {
            color: red;
        }
    </style>
</head>
<body>
    <div class="flowchart">
        <!-- Row 1 -->
        <div class="node" style="grid-column: 2;">goroutine 执行 Get</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>
        <div class="decision" style="grid-column: 2;"><span>当前 P 的本地缓存有对象?</span></div>

        <!-- Row 2 -->
        <div class="conditional" style="grid-column: 2;">
            <span class="yes">是</span>
            <span class="no">否</span>
        </div>
        <div class="node">返回本地缓存对象</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 3 -->
        <div class="decision" style="grid-column: 2;"><span>共享缓存有对象?</span></div>
        <div class="conditional" style="grid-column: 2;">
            <span class="yes">是</span>
            <span class="no">否</span>
        </div>

        <!-- Row 4 -->
        <div class="node">返回共享缓存对象</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 5 -->
        <div class="decision" style="grid-column: 2;"><span>其他 P 的本地缓存有对象?</span></div>
        <div class="conditional" style="grid-column: 2;">
            <span class="yes">是</span>
            <span class="no">否</span>
        </div>

        <!-- Row 6 -->
        <div class="node">窃取对象并返回</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 7 -->
        <div class="node">调用 New 函数创建新对象</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 8 -->
        <div class="node">返回新对象</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 9 -->
        <div class="node">goroutine 使用对象</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 10 -->
        <div class="node">goroutine 执行 Put</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>

        <!-- Row 11 -->
        <div class="decision" style="grid-column: 2;"><span>本地缓存是否已满?</span></div>
        <div class="conditional" style="grid-column: 2;">
            <span class="yes">是</span>
            <span class="no">否</span>
        </div>

        <!-- Row 12 -->
        <div class="node">放入本地缓存</div>
        <div class="arrow"><img src="https://via.placeholder.com/40x40?text=%E2%86%93" alt="down arrow"></div>
        <div class="node">放入共享缓存</div>
    </div>
</body>
</html>
